package com.nobradovic83.pygsto.domainmodel.beans;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import com.nobradovic83.pygsto.core.beans.BaseBean;
import com.nobradovic83.pygsto.domainmodel.OrderDetail;
import com.nobradovic83.pygsto.domainmodel.Product;
import com.nobradovic83.pygsto.domainmodel.ProductCategory;

@Entity
public class ProductBean extends BaseBean implements Product{
	private String productTitle, description;
	private Double price;
	private int quantity;
	private List<OrderDetail> orderDetails;
	private ProductCategory productCategory;
	
	public String getProductTitle() {
		return productTitle;
	}
	public void setProductTitle(String productTitle) {
		this.productTitle = productTitle;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public int getQuantity() {
		return quantity;
	}
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	public void setOrderDetails(List<OrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}
	@OneToMany(mappedBy="product", cascade = {CascadeType.ALL}, targetEntity=OrderDetailBean.class)
	public List<OrderDetail> getOrderDetails() {
		return orderDetails;
	}
	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
	}
	@OneToOne(cascade = {CascadeType.ALL}, targetEntity=ProductCategoryBean.class)
	public ProductCategory getProductCategory() {
		return productCategory;
	}
}
